1. Technical Field of the Invention
The present invention relates to a method, an apparatus, and a program for processing a stereo image. More particularly, the invention relates to a method, an apparatus, and a program for processing a stereo image in which a correspondence search is made between two images captured by two imaging devices to measure the parallax in stereophonic matching for obtaining three-dimensional position coordinates of an observation object from a plurality of images observed from different viewpoints on the basis of the principle of triangulation by utilizing the known positional relationship of two or more cameras.
2. Description of the Related Art
When an object is measured from two different viewpoints, a point on the object is projected on different positions in the respective observation images. The difference of measured positions between the images is referred to as parallax. Finding the parallax allows calculation of three-dimensional position coordinates of the point on the basis of the principle of triangulation.
In order to determine the parallax by a correspondence search between stereo images, a block matching method is often used by which a small area (block) in one (left) image is observed, a block having a luminance distribution most similar (the maximum correlation) to that of the block is searched from the other (right) image, and the parallax is determined by the relative position between the blocks in both images having the maximum correlation.
In block matching, a position different from a true corresponding position sometimes has the largest correlation by the influence of noise or the like. In the above simple matching method, however, correlation distribution in the block search range is not taken into consideration, thus often causing mismatching to reduce the reliability of the accuracy of parallax measurement.
In order to solve the above problem, various methods have been provided to improve reliability. For example, the correlation distribution in the block search range is investigated, wherein when there is a plurality of blocks with close similarity, the parallax is not determined and is detected only for high-reliability parts (for example, refer to Japanese Unexamined Patent Application Publication No. 2001-351200 (FIG. 1)).
Another example is a method by which the distribution of the correlation is investigated to evaluate the reliability of correspondence by the degree of matching indicated by the sharpness of the peak, wherein for a low-reliability part, the parallax is corrected on the basis of the continuity of parallax with the peripheral pixels to obtain high-reliability detailed measurement, so that the measurement can effectively be corrected in such a case that the measured parallax becomes suddenly discontinuous by the influence of noise or the like (for example, refer to Japanese Unexamined Patent Application Publication No. 2001-116513 (FIG. 1)).
Another example is a method by which two patches with different sizes (a small patch and a large patch) are prepared, wherein the small patch is used to pick out two or more candidates of the corresponding point and then the large patch is used to obtain correlation only for the positions of the candidates of the corresponding point and the one with the highest correlation is determined as a corresponding point, thus reducing erroneous correspondence when two or more patterns similar to the patch are present (for example, refer to Japanese Unexamined Patent Application Publication No. 2001-141424 (FIG. 1)).
Another method of phase-in corresponding-point search is provided to reduce the processing time by which a correspondence search area is narrowed with a low-resolution image and then an accurate correspondence search is carried out with a high-resolution image (for example, refer to Japanese Unexamined Patent Application Publication No. 7-103734 (FIG. 1)).
However, the method described in Japanese Unexamined Patent Application Publication No. 2001-351200 has the problem of low-density distribution of measured data.
The method described in Japanese Unexamined Patent Application Publication No. 2001-116513 has the possibility of increasing erroneous measurement in part although providing seemingly high-reliability detailed measurement because the parallax is forcibly corrected on the basis of the continuity of the peripheral parallax. When there are two or more corresponding-point candidates having highly similar correlation such as a repetition pattern, the correlation with a block in a position different from a true corresponding position is sometimes stronger than that in the true corresponding position, whereas by the related-art method, actual reliability is disadvantageously low.
According to the method described in Japanese Unexamined Patent Application Publication No. 2001-141424, by which a block size is further increased depending on the result of matching to repeat matching in order to improve the reliability of correspondence search, the processing cost of repeating the comparison of blocks due to an increase in block size is increased, so that the process time for obtaining a result is disadvantageously increased.
According to the method described in Japanese Unexamined. Patent Application Publication No. 7-103734 (FIG. 1), by which a corresponding-point search is made in stages using a hierarchical image, when a correspondence detection result with a low-resolution image is in error, the accuracy cannot be increased even if the search is conducted with a high-resolution image. In other words, the accuracy depends on the correspondence detection result with a low-resolution image (search area in a high-resolution image). However, since detailed information is lost in the low-resolution image, it is hard to increase the matching reliability.
The present invention has been made in consideration of the above situations. Accordingly, it is an object of the invention to achieve a high-reliability stereo correspondence search in a short processing time.